~ chicken-core (chicken-5) /manual/Deviations from the standard


  1[[tags: manual]]
  2
  3== Confirmed deviations from R5RS
  4
  5Identifiers are by default case-sensitive (see [[Using the compiler]]).
  6
  7=== Number of arguments to procedures and macros
  8
  9The maximal number of arguments that may be passed to a
 10compiled procedure or macro is limited to around 1000.
 11Likewise, the maximum number of values that can be passed
 12to continuations captured using {{call-with-current-continuation}}
 13is 1000.  This is an implementation restriction that is unlikely
 14to be lifted.
 15
 16
 17=== Numeric string-conversion considerations
 18
 19In some cases the runtime system uses the numerical string-conversion
 20routines of the underlying C library.  Consequently, the procedures
 21{{string->number}}, {{read}}, {{write}}, and {{display}} do not obey
 22read/write invariance for inexact numbers.
 23
 24
 25=== Environments and non-standard syntax
 26
 27In addition to the standard bindings, {{scheme-report-environment}} and
 28{{null-environment}} contain additional non-standard bindings for the
 29following syntactic forms: {{import}}, {{require-extension}},
 30{{require-library}}, {{begin-for-syntax}}, {{export}}, {{module}},
 31{{cond-expand}}, {{syntax}}, {{reexport}}, {{import-for-syntax}}.
 32
 33=== Assignment to unbound variables
 34
 35{{set!}} may assign values to unbound variables; this creates a new
 36top-level binding for the variable, as if {{define}} had been used
 37instead. This extension must be used with care, as typos might cause
 38unexpected results:
 39
 40<enscript highlight="scheme">
 41> (let ((frob 5))
 42    (set! frov (+ frob 1))  ; oops!
 43    frob)
 44> 5
 45> frov
 46> 6
 47</enscript>
 48
 49== Unconfirmed deviations
 50
 51=== {{char-ready?}}
 52
 53The procedure {{char-ready?}} always returns {{#t}} for
 54terminal ports.
 55
 56
 57
 58== Doubtful deviations
 59
 60=== {{letrec}}
 61
 62{{letrec}} does evaluate the initial values for the bound
 63variables sequentially and not in parallel, that is:
 64
 65<enscript highlight="scheme">
 66(letrec ((x 1) (y 2)) (cons x y))
 67</enscript>
 68
 69is equivalent to
 70
 71<enscript highlight="scheme">
 72(let ((x (void)) (y (void)))
 73  (set! x 1)
 74  (set! y 2)
 75  (cons x y) )
 76</enscript>
 77
 78where R5RS requires
 79
 80<enscript highlight="scheme">
 81(let ((x (void)) (y (void)))
 82  (let ((tmp1 1) (tmp2 2))
 83    (set! x tmp1)
 84    (set! y tmp2)
 85    (cons x y) ) )
 86</enscript>
 87
 88It is unclear whether R5RS permits this behavior or not; in any case,
 89this only affects letrecs where the bound values are not
 90lambda-expressions.
 91
 92
 93== Non-deviations that might surprise you
 94
 95=== {{let-syntax}} and {{letrec-syntax}}
 96
 97{{let-syntax}} and {{letrec-syntax}} introduce a new scope.
 98
 99
100=== {{equal?}} compares all structured data recursively
101
102{{equal?}} compares all structured data with the exception of
103procedures recursively, while R5RS specifies that {{eqv?}} is used for
104data other than pairs, strings and vectors.  However, R5RS does not
105dictate the treatment of data types that are not specified by R5RS
106
107
108=== {{transcript-on}} and {{transcript-off}} are not implemented
109
110The {{transcript-on}} and {{transcript-off}} procedures are
111not implemented.  R5RS does not require them.
112
113---
114Previous: [[Using the compiler]]
115
116Next: [[Extensions to the standard]]
Trap